<template>
  <div style="padding:10px;">
    <Tabs v-if="userType == 'user'">
      <TabPane label="个人信息" icon="md-apps">
        <Info />
      </TabPane>
      <TabPane label="查询" icon="md-apps">
        <StuQuery />
      </TabPane>
      <TabPane label="成绩" icon="md-apps">
        <Results />
      </TabPane>
    </Tabs>
    <Tabs v-if="userType == 'admin'">
      <TabPane label="裁判员信息" icon="md-apps">
        <Referee />
      </TabPane>
      <TabPane label="查询" icon="md-apps">
        <AdminQuery />
      </TabPane>
      <TabPane label="成绩录入" icon="md-apps">
        <Entry @change="entrNewResults" />
      </TabPane>
      <TabPane label="成绩排名" icon="md-apps">
        <Ranking :change="change" />
      </TabPane>
      <TabPane label="获奖名单" icon="md-apps">
        <Winners :change="change" />
      </TabPane>
    </Tabs>
  </div>
</template>

<script>
  //学生
  import Info from '@/components/student/info.vue'
  import StuQuery from '@/components/student/query.vue'
  import Results from '@/components/student/results.vue'
  //裁判员
  import Referee from '@/components/admin/referee.vue'
  import AdminQuery from '@/components/admin/query.vue'
  import Entry from '@/components/admin/entry.vue'
  import Ranking from '@/components/admin/ranking.vue'
  import Winners from '@/components/admin/winners.vue'
  export default {
    name: "Operation",
    components: {
      Info,
      StuQuery,
      Results,
      Referee,
      AdminQuery,
      Entry,
      Ranking,
      Winners
    },
    data () {
      return {
        change: null,//子组件通知的消息
        userType: window.sessionStorage.getItem("userType")
      };
    },
    methods: {
      entrNewResults (val) {
        this.change = val
      }
    },
  };
</script>

<style scoped></style>
